cs.jdoner.me · sorting
Selection Sort
Order
The official advice is to do Sorting before Files. Selection sort is short and it locks in points fast.
Half beats none
A method that does half the job and compiles beats one that does the whole job and does not.
{{ pz.rung }}
{{ pz.title }}
{{ pz.overload }}{{ pz.brief }}
Goal
{{ pz.goalText }}
Scores 0
{{ pz.zeroTrap }}
{{ c.v }}
{{ c.idx }}
{{ swap.va }}
{{ swap.vb }}
i
min
Swap speed
pass {{ ctl.pass }}
missteps {{ ctl.attempts }}
Array after
each pass
each pass
This is the diff: Main prints the sorted array, and your last row must match it.
{{ r.label }}
{{ c.v }}
{{ r.note }}
{{ hint.head }}
{{ hint.body }}
Matches the comment
{{ draw.why }}
{{ draw.text }}
On the APE you write this sort by hand from a provided Main, then diff the printed array against the comment. A built-in sort() scores 0. You just traced every pass yourself.